<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *客户列表
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$tabs=array(
	array('op'=>'list','title'=>'商品列表'),
);
//客户列表
if($_RQ['op']=='list'){
	$kcdata = cache_read('kcdata','jy_job2dao');
	cache_delete('kcdata','jy_job2dao');
	$list=array();
	foreach($kcdata as $item){
		$pipeis=$item['pipeis'];
		if($pipeis['optionids']){
			foreach($pipeis['optionids'] as $ovid){
				$option=pdo_get('jy_weishop_goods_option',array('id'=>$ovid,'uniacid'=>$_SESSION['uniacid']));
				$goods=pdo_get('jy_weishop_goods',array('id'=>$option['goodsid'],'uniacid'=>$_SESSION['uniacid']),array('id','title'));
				if($option['istaocan']){
					$goods['selespename']=$option['title'];
				}else{
					$specs=$option['specs'];
					$specs=explode("_",$specs);
					foreach($specs as &$spec){
						$spec=pdo_getcolumn('jy_weishop_goods_spec_item',array('id'=>$spec,'uniacid'=>$_SESSION['uniacid']),'title');
					}
					$goods['selespename']=implode("，",$specs);
				}
				$goods['price']=$item['update']['price'];
				$goods['costprice']=$item['update']['costprice'];
				$list[]=$goods;
			}
			
		}elseif($pipeis['goodsids']){
			foreach($pipeis['goodsids'] as $ovid){
				$goods=pdo_get('jy_weishop_goods',array('id'=>$ovid,'uniacid'=>$_SESSION['uniacid']),array('id','title'));
				$goods['price']=$item['update']['price'];
				$goods['costprice']=$item['update']['costprice'];
				$list[]=$goods;
			}
		}
	}
	$return['list']=$list;
	//页面显示设置
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','tip'=>'[温馨提示]：
		</br>1、下面是本次改价的【商品】
		','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
			array('type'=>'string','title'=>'ID','name'=>'id'),
			array('name'=>'title','title'=>'商品名称','type'=>'string'),
			array('name'=>'price','title'=>'现价','type'=>'string'),
			array('name'=>'costprice','title'=>'成本价','type'=>'string'),
		)),
	);
	$return['htmls']=$htmls;
	exi($return);
}